class Solution {
public:
    string maximumBinaryString(string binary) {
        int cnt = 0, idx = 0;
        int i = 0;
        bool f = 0;
        for (auto x : binary) {
            if (x == '0') {
                if (!f) {
                    f = 1;
                    idx = i;
                }
                cnt++;
            }
            i++;
        }
        if (!cnt)return binary;
        int n = binary.size();
        string ans;
        int t = n;
        while (t--) {
            ans += "1";
        }
        ans[idx + cnt - 1] = '0';
        return ans;
    }
};